import shutil

srcf = '/etc/passwd'
ddir = '/tmp/'
dstf = '/tmp/mima.txt'

with open('/etc/passwd', 'rb') as sfobj:
    with open('/tmp/mima.txt', 'wb') as dfobj:
        shutil.copyfileobj(sfobj, dfobj)

shutil.copyfile('/etc/passwd', '/tmp/mima2.txt')
shutil.copy('/etc/shadow', '/tmp/')
shutil.copy2(srcf, ddir)
shutil.move(dstf, '/opt/')
shutil.copytree('/etc/security', '/tmp/anquan')
shutil.rmtree('/tmp/anquan')
shutil.copymode('/etc/shadow', '/tmp/mima2.txt')
shutil.copystat('/etc/shadow', '/tmp/mima2.txt')
# shutil.chown('/tmp/mima2.txt', user='zhsan', group='zhsan')